//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2003 Intrinsyc Europe Ltd.
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2004 Siemens AG
//
// Version: 1.1.2.5
// Date:    11. Jan. 2006
//////////////////////////////////////////////////////////////////////////////


#pragma once

#define MSG_MSGBUF_LENGTH      (MAXLENGTH_MSG * 2 + 1)
#define MSG_CMDBUF_LENGTH      (MAX_ATCMD_LEN)
// We do not need this calculation: any string from or to the AT interface will not exceed MAX_ATCMD_LEN character
//#define MSG_CMDBUF_LENGTH      (MAX_PATH * 2 + MSG_MSGBUF_LENGTH)
#define MSG_ALLOC_NUMBER        16

// Special SMS handling: to have always some reserved space for incomming SMS, we use the MT
// storage. This is a combined store of SIM (SM) and module (ME). The SIM entries are the first
// in the index order. To the OS we do not report the existence of these additional SMS storage
// places to be sure that they are available in case they are needed to receive SMS during
// suspend.
#define SMS_PHASE2_CNMI          "AT+CNMI=2,1,2,2,1\r"
#define SMS_PHASE2PLUS_CNMI      "AT+CNMI=2,2,2,1,1\r"
#define SMS_INIT_PREFERRED_STORE "AT+CPMS=\"MT\",\"MT\",\"MT\"\r"
#define SMS_INIT_STORAGE_ORDER "AT^SSMSS=1\r"
#define MAX_SMS_IN_ME_STORAGE    25

HRESULT RILDrv_GetMsgServiceOptions(DWORD dwParam);
HRESULT RILDrv_SetMsgServiceOptions(DWORD dwParam, const RILMSGSERVICEINFO *lpMsgServiceInfo);
HRESULT RILDrv_GetMsgConfig(DWORD dwParam);
HRESULT RILDrv_SetMsgConfig(DWORD dwParam, const RILMSGCONFIG *lpMsgConfigInfo);
HRESULT RILDrv_GetCellBroadcastMsgConfig(DWORD dwParam);
HRESULT RILDrv_SetCellBroadcastMsgConfig(DWORD dwParam, const RILCBMSGCONFIG *lpMsgConfigInfo);
HRESULT RILDrv_ReadMsg(DWORD dwParam, DWORD dwIndex);
HRESULT RILDrv_DeleteMsg(DWORD dwParam, DWORD dwIndex);
HRESULT RILDrv_WriteMsg(DWORD dwParam, const RILMESSAGE *lpMessage, DWORD dwStatus);
HRESULT RILDrv_SendMsg(DWORD dwParam, const RILMESSAGE *lpMessage, DWORD dwOptions);
HRESULT RILDrv_SendStoredMsg(DWORD dwParam, DWORD dwIndex, DWORD dwOptions);
HRESULT RILDrv_SendMsgAcknowledgement(DWORD dwParam, BOOL fSuccess);

DWORD WINAPI CNMIReactivationThreadProc(LPVOID pVoid);

HRESULT ParseSMSListAndSendAck(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
